package com.tbit.uqbike.service.business.impl;

import com.tbit.uqbike.object.pojo.PayPalConfig;
import com.tbit.uqbike.service.business.PayPalConfigService;
import com.tbit.uqbike.webmanager.dao.core.PayPalConfigDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: chen
 * @Description: 国际支付
 * @Date: 创建于 14:45 2020/4/9
 */
@Service
public class PayPalConfigServiceImpl implements PayPalConfigService {
    @Autowired
    private PayPalConfigDao payPalConfigDao;

    @Override
    public PayPalConfig getByAccountId(Integer accountId) {
        return payPalConfigDao.getByAccountId(accountId);
    }

    @Override
    public void add(PayPalConfig payPalConfig) {
        PayPalConfig payPalConfigDB = getByAccountId(payPalConfig.getAccountId());
        if (payPalConfigDB != null) {
            payPalConfigDao.edit(payPalConfig);
        } else {
            payPalConfigDao.add(payPalConfig);
        }
    }
}
